package com.hotel.controller;

import com.hotel.pojo.Rights;
import com.hotel.service.RightService;
import com.hotel.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/rights")
public class RightsController {

    @Autowired
    private RightService rightService;

    /**
     * 查询一级二级数据
     * URL: /rights/getRightsList
     * 参数: 无
     * 返回值: SysResult(List<Rights>)
     * @return
     */
    @GetMapping("/getRightsList1")
    public SysResult getRightsList1(){
        List<Rights> rights1 = rightService.getRightsList1();
        return SysResult.success(rights1);
    }

    @GetMapping("/getRightsList2")
    public SysResult getRightsList2(){
        List<Rights> rights2 = rightService.getRightsList2();
        return SysResult.success(rights2);
    }

    @GetMapping("/getRightsList3")
    public SysResult getRightsList3(){
        List<Rights> rights3 = rightService.getRightsList3();
        return SysResult.success(rights3);
    }
}
